package com.basaji.util;

import org.apache.log4j.Logger;
import org.mortbay.log.Log;

import com.basaji.domain.pojo.Topic;

public class CheckDomain {

	private static Logger LOG = Logger.getLogger(CheckDomain.class);
	
	public static int checkTopic(Topic topic){
		if(topic.getUid() ==0){
			LOG.debug("topic uid is not 0");
			return -1;
		}
		if(topic.getContent()==null){
			LOG.debug("topic content is not null");
			return -2;
		}
		return 1;
	}
	
	public static int checkReply(Topic topic){
		if(topic.getUid() == 0){
			LOG.debug("topic uid is not 0");
			return -1;
		}
		if(topic.getContent()==null){
			LOG.debug("topic content is not null");
			return -2;
		}
		if(topic.getParentId()==0){
			LOG.debug("topic parent is not null");
			return -3;
		}
		return 1;
	}
}
